﻿using System.Collections.Generic;
using System.Workflow.ComponentModel;
using System;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Collections;
using System.Drawing;
using System.Linq;
using System.Workflow.ComponentModel.Compiler;
using System.Workflow.ComponentModel.Serialization;
using System.Workflow.Runtime;
using System.Workflow.Activities;
using System.Workflow.Activities.Rules;
using CommonLibrary.Wf.InterFace;
using CommonLibrary.DataModel.Basic;
using CommonLibrary.Wf.Common;

namespace CommonLibrary.Wf.ActivityUtil
{
    public partial class 等待发起者提交 : System.Workflow.Activities.HandleExternalEventActivity
    {
        public 等待发起者提交()
        {
            InitializeComponent();
        }

        private void 等待发起者提交_Invoked(object sender, System.Workflow.Activities.ExternalDataEventArgs e)
        {
            WaitReStartArgs args = e as WaitReStartArgs;
            if (args != null)
            {
                Dictionary<string, object> insParamater = args.insParamater;
                Activity temp = this;
                while (temp.Parent != null)
                {
                    temp = temp.Parent;
                }
                if (insParamater == null) return;
                if (temp != null && temp is BaseStateWorkflow)
                {
                    if (insParamater.Keys.Contains("创建者"))
                        (temp as BaseStateWorkflow).创建者 = (insParamater["创建者"] as UserEntity);
                    if (insParamater.Keys.Contains("流程名称"))
                        (temp as BaseStateWorkflow).流程名称 = insParamater["流程名称"].ToString();
                    if (insParamater.Keys.Contains("insValue"))
                        (temp as BaseStateWorkflow).insValue = (insParamater["insValue"] as Dictionary<string, string>);
                    if (insParamater.Keys.Contains("下一步处理人"))
                        (temp as BaseStateWorkflow).下一步处理人 = (insParamater["下一步处理人"] as ChoiceClrxx);
                }
                else if (temp != null && temp is BaseSequenceWorkflow)
                {
                    if (insParamater.Keys.Contains("创建者"))
                        (temp as BaseSequenceWorkflow).创建者 = (insParamater["创建者"] as UserEntity);
                    if (insParamater.Keys.Contains("流程名称"))
                        (temp as BaseSequenceWorkflow).流程名称 = insParamater["流程名称"].ToString();
                    if (insParamater.Keys.Contains("insValue"))
                        (temp as BaseSequenceWorkflow).insValue = (insParamater["insValue"] as Dictionary<string, string>);
                    if (insParamater.Keys.Contains("下一步处理人"))
                        (temp as BaseSequenceWorkflow).下一步处理人 = (insParamater["下一步处理人"] as ChoiceClrxx);
                }
            }
        }
    }
}
